package org.sample.springbootdatabase.domain;

import java.sql.Date;
import java.util.List;

import org.sample.springbootdatabase.domain.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface UserRepository extends JpaRepository<User, Long> {

	@Query(nativeQuery =  true, value = "SELECT * FROM user u WHERE u.user_name=:username")
	List<User> findByUserName(@Param("username") String userName);

	List<User> findByCreatedDate(Date createdDate);

}
